系统架构@ 内容 架构分层 架构功能 架构原理 ==架构技术 java osgi zkoss postgresql or Oracle c3p0 restlet hazelcast Atmosphere ==应用技术 Jasper javax.mail ActiveMQ fitnesse JUnit ECS ==工具技术 objectweb cron4j slf4j cryptacular passay xerces ==其他 如何理解系统的技术? 代码的编写年份大致从99的compiere的出现,到06年ad出现,再到11年id的出现,分别对应当时的开发技术。 如何查找当前用了哪些技术? 在发行版或者bin安装的plugin目录,显示了所有插件的运行环境或者文件夹。文件名包含具体版本信息,一眼看过去,大致就知道自己哪些熟悉,哪些陌生了。 https://www.zhihu.com/question/26971829 快速分析代码 https://groups.google.com/d/msg/idempiere/tXPa9qwoDiE/O1PXGFLVBgAJ 一个快速的了解 id是ad的osgi分支,没有使用常见的spring + ORM 框架,都是自己的。 ad的另外一个分支metasfresh使用spring框架+react前端。 ad的spring架构重构:https://sourceforge.net/p/adempiere/discussion/611167/thread/113a0bd7/ 有一个国内java框架Netz手册写得很好,可以去看下 https://nutzam.com/core/nutz_preface.html Adempiere论坛对自己的架构的思路 https://sourceforge.net/p/adempiere/discussion/610548/thread/5650b9c4/ “When we analyze the code of ADempiere in retrospective, we can see the course of time and evolution of underwent. It went from the original client/server based on Java swing with direct database access via pure SQL sentences to the current own ORM combined with SQL to access the data and the MVC application based on te AJAX web client. Even though technology has moved on, our domain model has persisted; that is why we can infer that the most important asset of ADempiere is the Application Dictionary which preserves the domain model and the business logic. Thanks to the fact that ADempiere was drafted and developed on a Model Driven Architecture MDA (3), the domain model is protected of obsolescence by the Application Dictionary As a voluntary person, responsible for the future architecture of beloved ADempiere, we will adopt the DDD approach as the main line of development.” “The Architecture is based on Domain Driven Design as the primary basis of design, of course without losing all wonderful benefits of the Application Dictionary. The new architecture is intended to be made with multi layer and a reactive application type http://www.reactivemanifesto.org/ # reactive-reactive. In our preliminary study we have preselected some of the development frameworks with which we will work. 1.- Development Language Scala, Java as platform 2.- Persistence Engine and DAO (http://activate-framework.org/) 3.- Dependencies Management (http://www.scala-sbt.org/) 4.- Environment building applications (http://typesafe.com/activator), http://scala-ide.org/, IntelliJ Scala plugin 5.- Concurrency, Clustering & load balancing (http://akka.io/) 6.- Deployment of JSON Services (http://spray.io/) 7.- Development UI Framework (https://github.com/henrikerola/scaladin).” Adepiere另一个想法: https://sourceforge.net/p/adempiere/discussion/610548/thread/80ee1c01 其他人的想法: https://sourceforge.net/p/adempiere/discussion/611158/thread/7cbf4a30/?limit=25#5291/4c34 http://gryb.info/soapiere/SoapiereWhitePapers.html @2007-04-22 I think that the 2 biggest problems Compiere has are: - It's not completely data base independent. - It uses thick client with slow and faulty GUI (see [2]). To achieve better data independence and endow users with a thin client option (read: web browser + Java script) the following approach is being suggested in the scope of this project that I will call “SOAPiere” until a better name is found: - Create a DB independent data model using Hibernate tools (see [3]). - Build web services on the top of the Hibernate data model. - Use web services to build a pure HTTP based web portal where all existing Compiere functionality will be implemented using Hibernate data model. - Use web services on different client platforms to implement client specific tasks (e.g. Reports that are not available out of the box, a GUI that better fits to the client's environment, etc.) 架构分层 ..... 架构功能 http://www.cnblogs.com/fifiyong/p/6388878.html Spring框架由7个定义良好的模块(组件)组成,各个模块可以独立存在,也可以联合使用。 (1)Spring Core:核心容器提供了Spring的基本功能。核心容器的核心功能是用Ioc容器来管理类的依赖关系.Spring采用的模式是调用者不理会被调用者的实例的创建,由Spring容器负责被调用者实例的创建和维护,需要时注入给调用者。这是目前最优秀的解耦模式。 (2)Spring AOP:Spring的AOP模块提供了面向切面编程的支持。SpringAOP采用的是纯Java实现。Spring AOP采用基于代理的AOP实现方案,AOP代理由Ioc容器负责生成、管理,依赖关系也一并由Ioc容器管理,尽管如此,Spring Ioc容器并不依赖于AOP,这样我们可以自由选择是否使用AOP。 (3)Spring ORM:提供了与多个第三方持久层框架的良好整合。 (4)Spring DAO: Spring进一步简化DAO开发步骤,能以一致的方式使用数据库访问技术,用统一的方式调用事务管理,避免具体的实现侵入业务逻辑层的代码中。 (5)Spring Context:它是一个配置文件,为Spring提供上下文信息,提供了框架式的对象访问方法。Context为Spring提供了一些服务支持,如对国际化(i18n)、电子邮件、校验和调度功能。 (6)Spring Web:提供了基础的针对Web开发的集成特性,例如多方文件上传,利用Servlet listeners进行IoC容器初始化和针对Web的applicationContext. (7)Spring MVC:提供了Web应用的MVC实现。Spring的MVC框架并不是仅仅提供一种传统的实现,它提供了一种清晰的分离模型,在领域模型代码和web form之间。并且,还可以借助Spring框架的其他特性 idempiere的框架和spring比较,到底是如何实现的? 1. ioc 2. aop 3. orm 4. dao 5. context 6. web 7. mvc 架构原理 后端: 前端: https://sourceforge.net/p/adempiere/discussion/611167/thread/113a0bd7/ 2009年法国一个公司对ad进行的spring重构 QUESTION:<By: Colin Rooney (croo)> potentially it sounds like the whole persistence is replaced, the UI is replaced and services layer is formalised (rather than just being a coding practice around MClasses) ... all good things I think. So the question is .. 1.- What happen with the more important Adempiere Business Logic that are in all model class (MInvoice)? 2.- What happen with the UI engine (Callout, Dynamic Display Rules)? 3.- What happen with the rest the Adempiere Engine (Account, Processor, etc)? 4.- How was migrate the Application Dictionary? ANSWER The Most part of the persistence layer is realised by iBatis Mapper; nevertheless some features are delagates to PO and currently.Our technical team is currently pushing to confine some rest of ADempiere into stored proc so that our DAO layer based on iBatis will also directly call those stored proc. The Swing UI is replaced by a web MVC UI entirely based on Struts 2 and struts2 validators are used instead of callout and original validadtions Each MClassis is encapsulate in a Component including 3parts: - cross Data part (DTO,Criteria) - Business in 2 layers (SimpleServices,HighLevelServices) - Data access in DAO layer A process engine is put on to run a process knowing just his AD_Process_ID and calling parameters Our report are done by the framework jasperReport and we used ADempiere DataEngine just to retreive data that should be printed for a particular AD_Pinstance_ID, and by an conversion mechanism they are passed to jasperReport. The front-end of koosseryADempiere is complete webapp based on Struts 2. We use our MDA framework KoosseryOptimadev to generate jsp files,actions code, all configurations ressources files(spring, struts.xml and other). Our MDA framework (KoosseryOptimadev) generate jsp files but at this moment it does'nt immediately appear in the webUI, We define a new approach to generate webUI base on UML representation from the Adempiere Dictionary。 ==架构技术 java Oracle JDK 或者 openJDK osgi http://surfacedetail.blogspot.com/2017/07/idempiere-and-osgi-modular-java.html (要梯子) equinox felix web console jetty zkoss 前端框架 org.zkoss.library包都已经打碎了,也可以按照自己的需求来下载 + zcommon + zel + zhtml + zk + zkbind + zkplus + zul + zweb postgresql or Oracle 数据库 c3p0 C3P0是一个开源的JDBC连接池,它实现了数据源和JNDI绑定,支持JDBC3规范和JDBC2的标准扩展。目前使用它的开源项目有Hibernate,Spring等。 restlet http://restlet.com/products/restlet-framework/ Restlet 帮助Java程序员建立大规模的快速的符合 RESTful 架构模式的web api。 它提供了强大的路由和 filtering 系统。统一的client/server Java API. 满足所有主要的平台 (Java SE/EE, Google AppEngine, OSGi, GWT, Android) 以及提供了无数的扩展以满足程序员的需求。 据我说知,它是第一个 java RESTful web 框架。很多公司都在用它,但是你可能从未听说过它,好像它已经不可见了。 http://www.importnew.com/17138.html 8个java restful框架 hazelcast https://hazelcast.org Hazelcast是一个用Java编写的基于内存的数据网格管理平台(open source in-memory data grid)。Hazelcast作为一个高度可扩展的数据分发和集群平台,提供了高效的、可扩展的分布式数据存储、数据缓存。Hazelcast是开源的,在分布式技术方面,Hazelcast提供了十分友好的接口供开发者选择,如Map,Queue,ExecutorService, Lock和Jcache。 Hazelcast的稳定性很高,分布式应用可以使用Hazelcast进行存储数据、同步数据、发布订阅消息等。Hazelcast是基于Java开发的,其客户端有Java, C/C++, .NET以及REST。Hazelcast同时也支持memcache协议。它很好的支持了Hibernate,可以很容易的在当今流行的数据库系统中应用。 http://angelbill3.iteye.com/blog/2342989 缓存技术 Atmosphere http://atmosphere.java.net 官方 长轮询:原理是客户端发出一个http长连接请求,然后等待服务器的响应,服务器接到请求之后,并不立即发送出数据,而是hold住这个Connecton。这个处理是非阻塞的,所以服务器可以继续处理其他请求。在某个时刻,比如服务器有新数据了,服务器再主动把这个消息推送出去,即通过之前建立好的连接将数据推送给客户端。客户端收到返回。这个时候就可以处理数据,然后再次发起新的长连接。服务器压力一般,实时性很高。Servlet 3.0开始已经支持该技术。sina微博就是使用的原生Servlet 3实现的消息推送。 其他类似框架 1、Cometd http://cometd.org/ 基于Bayeux协议实现,支持长轮询、WebSocket等.. 2、Pushlet http://www.pushlets.com/ 基于HTTP流的JSP/Semlet技术实现 3、DWR http://directwebremoting.org/dwr/index.html “据我的了解,使用最多的应该是 DWR 和 Cometd了,其中Cometd功能强大使用又简单。我参与的一个项目中使用Cometd 做前台地图上人员轨迹的实时推送,几百个人员的实时轨迹推送都是没问题的。用。Cometd前台有2个实现版本 jQuery 和 Dojo,也可以用js但是会复杂点。(PS Cometd 官方文档相当使用,遇到问题就读一遍,肯定能找到你想要的。 http://docs.cometd.org/reference/)” ==应用技术 Jasper 报表工具 javax.mail 邮件 ActiveMQ ActiveMQ 是Apache出品,最流行的,能力强劲的开源消息总线。ActiveMQ 是一个完全支持JMS1.1和J2EE 1.4规范的 JMS Provider实现 fitnesse FitNesse是一套软件测试工具 从另外一个角度看,FitNesse是一个轻量级的、开源的框架,能够帮助开发团队方便的定义验收测试(Acceptance Tests),通过在web页面上简单的输出和预计输出的表格就可实现,并且可以运行这些测试以确定是否通过。 selenium JUnit JUnit是一个Java语言的单元测试框架。 Hamcrest是一个书写匹配器对象时允许直接定义匹配规则的框架。 ECS Jakarta Element Construction Set(ECS)是一个使用Java语言和面向对象方法创建标记语言文档(HTML,XML)的开源项目。 ==工具技术 事务、日志、安全、邮件等 部分包直接放置在org.adempiere.base根目录下。 objectweb JOTM 是一个基于Java开放源代码的事务处理管理器。它遵循JTA APIs规范与Business Transaction Protocol(BTP)规范以提供了对Web Service的支持。 cron4j 定时器 slf4j 日志接口,后面用的是JDK自带的JUL(java.util.logging) cryptacular The spectacular complement to the Bouncy Castle crypto API for Java. passay Library for checking that a password complies with a custom set of rules xerces Apache Xerces 是一个非常健壮的 XML 解析器,是 Apache XML 组的核心项 目,其前身是 IBM 的 XML4C 项目。 提供的两种解析 XML 文档的方法: SAX 是一个面向事件的编程 API。一个解析引擎消耗 XML 序列数据,并在发现进 来的 XML 数据的结构时回调应用程序,这些回调称为事件句柄。 DOM(文档对象模型)与 SAX 不同,它允许对 XML 文档进行编辑并保存为一个 文件或者流,还允许以编程的方式构建一个 XML 文档。DOM 提供了一个内存中的模型, 你可以遍历文档树,删除节点或者嫁接新节点。与解析的 SAX 事件不同,DOM 事件反映 出用户与文档的互动以及使用文档的改变。 总的来说,SAX 是按行遍历 XML 文档的,而 DOM 是先把 XML 文档生成树,然 后遍历 DOM 树,来解析每个节点。 ==其他 https://www.zhihu.com/question/20889144 MDA/DDD方法